<?php
namespace Home\Controller;
use Think\Controller,
    Common\Common\Common,
    Home\Common\User,
	Lib\Controller\BaseController;

class UserController extends BaseController
{
    public function registerAction($username = '', $password = '', $repassword = '', $mail = ''){
        
        if(($password != $repassword) && $password != null){
            $this->apiError('param-error:pwd:error');
            return;
        }

        $user = new User();
        $UId = $user->register($username, $password, $mail)
        $this->apiSuccess($UId);
    }

    public function loginAction($username = '', $password = ''){
        $user = new User();
        $this->apiSuccess($user->login($username, $password));
        return ;
    }

    public function logoutAction(){

    }

    public function renameAction($uid, $password, $newname){
        $user = new User();
        $data['username'] = $newname;
        $this->apiSuccess($user->updateInfo($uid, $password, $data))
        return ;
    }

    public function repwdAction($uid, $password, $pwd){
        $user = new User();
        $data['password'] = $pwd;
        $this->apiSuccess($user->updateInfo($uid, $password, $data))   
        return ;    
    }

    public function remainlAction($uid, $password, $pwd){
        $user = new User();
        $data['email'] = $email;
        $this->apiSuccess($user->updateInfo($uid, $password, $data))   
        return ; 
    }

    public function infoAction($uid){
        $user = new User();
        $this->apiSuccess($user->info($uid))   
        return ; 
    }

    public function datalistAction($uid){
        $user = new User();
        $this->apiSuccess($user->datalist($uid))   
        return ; 
    }

    // public function usizeAction(){

    // }

    // public function sizeAction(){

    // }
    
}
